home *** CD-ROM | disk | FTP | other *** search
Text File | 2000-09-28 | 4.1 KB | 121 lines | [TEXT/CWIE] |
- /*
- File: LogEngine.h
-
- Contains: The core code to talk to the STREAMS log module.
-
- Written by: Quinn "The Eskimo!"
-
- Copyright: Copyright © 1998-1999 by Apple Computer, Inc., All Rights Reserved.
-
- You may incorporate this Apple sample source code into your program(s) without
- restriction. This Apple sample source code has been provided "AS IS" and the
- responsibility for its operation is yours. You are not permitted to redistribute
- this Apple sample source code as "Apple sample source code" after having made
- changes. If you're going to re-distribute the source, we require that you make
- it clear in the source that the code was descended from Apple sample source
- code, but that you've made changes.
-
- Change History (most recent first):
- 7/23/1999 Karl Groethe Updated for Metrowerks Codewarror Pro 2.1
-
-
- */
-
- /////////////////////////////////////////////////////////////////////
- // Pick up toolbox "Files.h", which is needed
- // to make OpenTptClient.h compile.
- #pragma once
- #include <Files.h>
-
- /////////////////////////////////////////////////////////////////////
- // Pick up low-level OT APIs.
-
- #include <OpenTptClient.h>
- #include <strlog.h>
-
- /////////////////////////////////////////////////////////////////////
- // Core Data Structure
-
- enum {
- kMagicValue = 'Bing'
- };
-
-
- struct LogEntry{
- OTLink *fNext;
- OSType fMagic; // Must be kMagicValue
- UInt32 fRefCount;
- UInt32 fTextLength;
- struct log_ctl fLogHeader;
- // variable length text goes here
- };
- typedef struct LogEntry LogEntry;
- typedef struct LogEntry* LogEntryPtr;
-
- extern pascal void RetainLogEntry(LogEntry* thisEntry);
- // Increments the reference count for the log entry.
- // Clients can call this function to hold on to log
- // entries that are passed to them by ForEachNewLogEntry.
- //
- // Context: SystemTask /only/
-
- extern pascal void ReleaseLogEntry(LogEntry* thisEntry);
- // Decrements the reference count for the log entry,
- // and frees the entry if count decrements to zero.
- // Clients should eventually call this function to free
- // any log entry they have retained.
- //
- // Context: SystemTask /only/
-
- /////////////////////////////////////////////////////////////////////
-
- extern pascal OSStatus StartLogging(Boolean logErrors,
- UInt32 traceInfoCount, struct trace_ids traceInfo[]);
- // Tells the module to start logging. If logErrors is true,
- // the log will contain all strlog messages that have the
- // SL_ERROR bit in the flags when they are created. If
- // traceInfoCount is non-zero, then we're also logging
- // traces. traceInfo must point to an array of trace_ids
- // that describe which traces we're interested in. Each
- // trace_id contains a field for module ID, for stream ID,
- // and for level. Each field specifies the value of that
- // parameter we accept, or -1 to accept any value for that
- // parameter. For example, the mid field is the module ID
- // whose traces we should accept, or -1 if you want to accept
- // traces for all modules.
- //
- // Context: SystemTask /only/
-
- extern pascal void StopLogging(void);
- // Stops the logging process. Call this if and only if
- // StartLogging returns noErr. After stopping logging
- // you should call ForEachNewLogEntry to get any log
- // entries that might have accumulated in the time
- // between you making the StopLogging call and the time
- // that logging actually stops.
- //
- // Context: SystemTask /only/
-
- extern pascal Boolean LoggingActive(void);
- // Returns whether logging is currently active.
- //
- // Context: SystemTask /only/
-
- extern pascal UInt32 NumberOfDroppedLogEntries(void);
- // Returns the number of log entries that have been
- // dropped due to memory constaints. This should
- // always be zero.
- //
- // Context: SystemTask /only/
-
- typedef pascal void (*ProcessLogEntryProcPtr)(LogEntry* logEntry, void *refCon);
-
- extern pascal void ForEachNewLogEntry(ProcessLogEntryProcPtr doThis, void *refCon);
- // This routine calls the supplied doThis routine for each
- // log entry that has arrived since the last time you called
- // this routine. The log entry is immediately released
- // after doThis returns, so you should call RetainLogEntry
- // if you keep a reference to it.
- //
- // Context: SystemTask /only/
-